﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using NObsidian.Containers;

namespace NObsidian.Managers
{
    public class UserManager : ManagerBase
    {
        public UserManager(ObsidianProxy proxy)
            : base(proxy)
        {
        }

        public User ShowMe()
        {
            return ShowUser("me");
        }

        public User ShowUser(string userId)
        {
            string showUser;
            string url;

            url = ComposeShowUser(userId);
            showUser = _proxy.GetObsidianData(url);

            return _proxy.GetObjectFromJson<User>(showUser);
        }

        private string ComposeShowUser(string userId)
        {
            StringBuilder sb = new StringBuilder();
            return sb.Append(USERS_URL).Append(userId).Append(".json").ToString();
        }
    }
}
